/* 人事-基础设置-人员设置api */

import { ajaxService } from '@/utils/request';

const env = import.meta.env;
// const baseURL = env.VITE_DEV_BASE_URL;
// const baseURL = 'http://192.168.31.129:39001';
// const baseURL = 'http://192.168.31.129:39001';
// const baseURL2 = 'http://192.168.31.129:39002';
const baseURL = env.VITE_DEV_BASE_URL;
const baseURL2 = env.VITE_DEV_BASE_URL;
// const baseURL2 = env.VITE_DEV_BASE_URL;
// const baseURL2 = env.VITE_APP_BASE_URL;

// 获取人才标签
export function GetHumanLabel(params?: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag_type/per/tag/type/list',
    method: 'get',
    baseURL,
    params
  });
}
/**
 * 人才标签查重
 * @param params
 * @returns
 */
export function CheckumanLabel(params?: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag_type/check/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 删除人才标签
export function DelHumanLabel(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag_type/per/tag/type',
    method: 'delete',
    baseURL,
    data
  });
}

// 新增人才标签
export function PostHumanLabel(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag_type/per/tag/type',
    method: 'post',
    baseURL,
    data
  });
}

// 修改人才标签
export function PutHumanLabel(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag_type/per/tag/type',
    method: 'put',
    baseURL,
    data
  });
}
// 获取人才子标签
export function GetHumanSubLabel(params: { tagTypeId: number }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag/per/tag/list',
    method: 'get',
    baseURL,
    params
  });
}

// 新增人才子标签
export function PostHumanSubLabel(data: { tagTypeId: number; name: string }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag/per/tag',
    method: 'post',
    baseURL,
    data
  });
}

// 编辑人才子标签
export function PutHumanSubLabel(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag_type/per/tag',
    method: 'put',
    baseURL,
    data
  });
}

// 删除人才子标签
export function DelHumanSubLabel(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag/per/tag',
    method: 'delete',
    baseURL,
    data
  });
}
/**
 * 人才子标签查重
 * @param params
 * @returns
 */
export function GetHumanSubLabelRepeat(params: {
  tagTypeId: number;
  name: string;
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_tag_setting/personnel_tag/check/repeat',
    method: 'get',
    baseURL,
    params
  });
}

/**
 * 获取异动类型和原因
 * @param params type 1人事异动 2薪酬异动
 * @returns
 */
export function GetHumanChangeSettingType(params: { name: string }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes',
    method: 'get',
    baseURL,
    params
  });
}

/**
 * 新增异动类型和原因
 * @param params
 * @returns
 */
export function PostHumanChangeSettingType(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes',
    method: 'post',
    baseURL,
    data
  });
}

/**
 * 获取异动类型和原因
 * @param params
 * @returns
 */
export function PutHumanChangeSettingType(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes',
    method: 'put',
    baseURL,
    data
  });
}

/**
 * 获取异动类型和原因
 * @param params
 * @returns
 */
export function DelHumanChangeSettingType(params: { id: number }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes',
    method: 'delete',
    baseURL,
    params
  });
}

/**
 * 查重异动类型
 * @param params type 1人事异动 2薪酬异动
 * @param params name 名称
 * @returns
 */
export function CheckHumanChangeSettingType(params: {
  type: 1 | 2;
  name: string;
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 新增人员异动设置列表
export function PostHumanChangeSetting(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes/per/changes',
    method: 'post',
    baseURL,
    data
  });
}
/**修改人员异动设置列表
 *  */

export function PutHumanChangeSetting(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes/per/changes',
    method: 'put',
    baseURL,
    data
  });
}

/**
 *  获取人员异动设置列表
 * @param data
 * @returns
 */
export function GetHumanChangeSetting(params: {
  funcType: number; //异动业务类型(1 人事异动 2 薪酬调整 3 劳动合同 4 社保公积金)
  changeType: number; //异动类型(1 转正式员工 2 调岗 3 晋升 5 降级 )
}) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes/per/changes/list',
    method: 'get',
    baseURL,
    params
  });
}

/**
 *  获取人员异动设置列表所有设置数据
 * @param data
 * @returns
 */
export function GetAllHumanChangeSetting() {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes/detail',
    method: 'get',
    baseURL
  });
}

// 新增修改人员异动设置列表查重
export function CheckHumanChangeSetting(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes/check/repeat',
    method: 'get',
    baseURL,
    params
  });
}

// 删除人员异动设置列表
export function DelHumanChangeSetting(data: { ids: number[] }) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/personnel_changes/per/changes',
    method: 'delete',
    baseURL,
    data
  });
}

// 获取人员模板列表
export function GetHumanTemplateList(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/per/template/detail/page',
    method: 'get',
    baseURL: baseURL2,
    params
  });
}

// 新增修改人员模板查重
export function CheckHumanTemplateList(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/per/template/repeat',
    method: 'get',
    baseURL: baseURL2,
    params
  });
}

// 删除人员模板列表
export function DelHumanTemplateList(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/per/template/detail',
    method: 'delete',
    baseURL: baseURL2,
    data
  });
}

// 修改人员模板列表默认模板状态
export function PutHumanTemplateState(params: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/per/template/default',
    method: 'put',
    baseURL: baseURL2,
    params
  });
}

// 获取人员模板详情
export function GetHumanTemplateDetail(params: any) {
  return ajaxService({
    url: `/hr/personnel_matters/basic_setting/personnel_settings/per/template/detail`,
    method: 'get',
    baseURL: baseURL2,
    params
  });
}

// 新增人员模板
export function PostHumanTemplate(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/per/template/detail',
    method: 'post',
    baseURL: baseURL2,
    data
  });
}

// 修改人员模板
export function PutHumanTemplate(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/per/template/detail',
    method: 'put',
    baseURL: baseURL2,
    data
  });
}

// 删除人员模板子集/控件
export function DelHumanTemplateDetails(data: any) {
  return ajaxService({
    url: '/hr/personnel_matters/basic_setting/personnel_settings/per/template/detail',
    method: 'delete',
    baseURL: baseURL2,
    data
  });
}
